<template>
  <div class style="padding: 20px;">
    <div class="fw p10">
      <div class="fwwcc">
        <div class="block">
          <span class="demonstration m10">请选择时间范围</span>
        </div>
        <el-date-picker
          v-model="value2"
          type="datetimerange"
          :picker-options="pickerOptions"
          range-separator="至"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
          align="right"
        ></el-date-picker>
      </div>
      <div class="p10">
        <el-button type="primary" @click="1">查询</el-button>
      </div>
    
    </div>
    <div class="p10">
      <el-table :data="tableData" style="width: 100%">
        <el-table-column prop="date" label="日期" width=""></el-table-column>
        <el-table-column prop="name" label="日志类型" width=""></el-table-column>
        <el-table-column prop="address" label="内容"></el-table-column>
      </el-table>
    </div>
    <div class="fwwcc p10">
      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="currentPage4"
        :page-sizes="[5, 10, 20, 50]"
        :page-size="5"
        layout="total, sizes, prev, pager, next, jumper"
        :total="4"
      ></el-pagination>
    </div>
  </div>
</template>
<script>
export default {
  components: {},
  data() {
    return {
      pickerOptions: {
        shortcuts: [
          {
            text: "最近一周",
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
              picker.$emit("pick", [start, end]);
            }
          },
          {
            text: "最近一个月",
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
              picker.$emit("pick", [start, end]);
            }
          },
          {
            text: "最近三个月",
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
              picker.$emit("pick", [start, end]);
            }
          }
        ]
      },
      value2: "",
      currentPage4: 4,
      tableData: [
        {
          date: "2020-01-02",
          name: "告警",
          address: "乐至机房5号服务器cpu使用率过高"
        },
        {
          date: "2020-01-04",
          name: "错误",
          address: "乐至机房3号服务器数据库离线"
        },
        {
          date: "2020-01-01",
          name: "异常",
          address: "乐至机房10号服务器关机"
        },
        {
          date: "2020-01-03",
          name: "正常",
          address: "乐至机房7号服务器启动上线"
        }
      ]
    };
  },
  computed: {},
  watch: {},
  mounted() {},
  methods: {
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
    }
  }
};
</script>
<style lang='scss' scoped>
</style>